
#include "list.h"



void Listtest1()
{
	ListNode* plist = listInit();
	ListPushBack(plist, 1);
	ListPushBack(plist, 8);
	ListPushBack(plist, 3);
	ListPushBack(plist, 12);
	ListPushBack(plist, 7);
	ListPushBack(plist, 5);

	ListPrint(plist);

	ListPopBack(plist);
	ListPopBack(plist);
	ListPopBack(plist);
	ListPopBack(plist);

	ListPrint(plist);

	ListPushFront(plist, 90);
	ListPushFront(plist, 21);
	ListPushFront(plist, 55);

	ListPrint(plist);

	//ListPopFront(plist);
	//ListPopFront(plist);
	//ListPopFront(plist);
	//ListPopFront(plist);
	//ListPopFront(plist);
	////ListPopFront(plist);
	////ListPopFront(plist);
	////ListPopFront(plist);

	//ListPrint(plist);

	ListNode* pos = ListFind(plist, 21);
	ListInsert(plist, pos, 114);

	pos = ListFind(plist, 55);
	ListInsert(plist, pos, 44);
	
	pos = ListFind(plist, 8);
	ListInsert(plist, pos, 514);

	ListPrint(plist);

	ListDistroy(plist);
}

void Listtest2()
{
	ListNode* plist = listInit();
	ListPushBack(plist, 1);
	ListPushBack(plist, 8);
	ListPushBack(plist, 3);
	ListPushBack(plist, 12);
	ListPushBack(plist, 7);
	ListPushBack(plist, 5);

	ListPrint(plist);

	ListNode* pos = ListFind(plist, 1);
	ListErase(plist, pos);

	pos = ListFind(plist, 5);
	ListErase(plist, pos);

	pos = ListFind(plist, 8);
	ListErase(plist, pos);

	pos = ListFind(plist, 7);
	ListErase(plist, pos);

	pos = ListFind(plist, 3);
	ListErase(plist, pos);

	ListPrint(plist);

	ListDistroy(plist);
	plist = NULL;
}



int main()
{
	//Listtest1();
	Listtest2();

	return 0;
}